Local variables function as though they were temporary attributes defined in a specific logic section which disappear when the logic section is finished executing. Local variables are useful for test variables in loops and storing locally used, unique values for each entity at the current location.
Local variables are used within a block of logic (i.e., operation logic, subroutines) and are declared with an INT or REAL statement. Local variables are only available within the logic in which they are declared and are not defined in the Variables edit table. A new local variable is created for each entity to encounter an INT or REAL statement. See Int and Real for more information. A local variable is specific to each entity, in much the same way an attribute is specific to an entity, except that the local variable is only available while the entity processes the logic to declare the local variable. Local variables may be passed to subroutines as parameters. Local variables are available to macros.
Entity... |
Location... |
Operation (min)... |
Valve |
Inspect |
WAIT 5 |
Pallet |
Dock |
INT X X = p_type LOAD 10 IFF X = v_type WAIT 10 |
Output... |
Destination... |
Rule... |
Move Logic... |
|
1 |
Valve |
Dock |
LOAD 1 |
MOVE FOR 2 |
1 |
Pallet |
Delivery |
FIRST 1 |
MOVE FOR 8 |
As can be seen from the two examples of logic, the first example is much easier and more straight forward.
Local Variable Notes: 1. You may not use the WAIT UNTIL statement with local variables. 2. The local variable definition only needs to appear somewhere in the logic before being referenced. The entity does not need to execute the local variable definition statement (INT, REAL).
![]() |
© 2012 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com |